#include <iostream>
#include <map>

std::pair<int, std::string> func()
{
    return {1, "zhangsan"};
}

struct Test
{
    int x;
    char y;
    double z;
};

int main()
{
    std::map<int, std::string> m =
        {
            {1, "zhangsan"},
            {2, "wangwu"}};

    // for (auto &value : m)
    // {
    //     std::cout << value.first << " " << value.second << std::endl;
    // }

    // 结构化绑定
    // for (auto &[id, name] : m)
    // {
    //     std::cout << id << " " << name << std::endl;
    // }

    auto [id, name] = func();
    std::cout << id << " " << name << std::endl;

    Test t = {1, 'a', 3.14};
    auto [a, b, c] = t;
    std::cout << a << " " << b << " " << c << std::endl;

    a = 100;
    std::cout << t.x << std::endl;
    return 0;
}
